﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;
using System.Text;
using XQ.Framework.core;

namespace lib
{
    /// <summary>
    /// Summary description for HttpFilter
    /// </summary>
    public class HttpFilter : IHttpModule
    {

        public void Dispose()
        {
            //
        }

        public void Init(HttpApplication context)
        {
            context.AcquireRequestState += new EventHandler(HttpFilterFunc);
        }

        private void HttpFilterFunc(object source, EventArgs e)
        {
            try
            {
                HttpApplication app = (HttpApplication)source;
                HttpContext context = app.Context;
                HttpSessionState session = app.Session;
                HttpRequest request = app.Request;
                HttpResponse response = app.Response;
                //
                request.ContentEncoding = Config.SystemEncoding();
                response.ContentEncoding = Config.SystemEncoding();
            }
            catch (Exception err)
            {
                Console.Write(err.Message);
            }
        }

    }
}